package cn.peifu.hrm.fallback;

import cn.peifu.hrm.CourseDoc;
import cn.peifu.hrm.feign.CourseFeign;
import cn.peifu.hrm.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class CoursefeignFallbackFactory implements FallbackFactory<CourseFeign> {
    @Override
    public CourseFeign create(Throwable throwable) {
        return new CourseFeign() {
            @Override
            public AjaxResult save2Es(CourseDoc courseDoc) {
                throwable.printStackTrace();
                return AjaxResult.me().setSuccess(false).setMessage("es服务降级");
            }
        };
    }
}
